/*
 * ORCA sniffer 
 */

# ifndef __ORCA_H__
# define __ORCA_H__ 

#include <sys/socket.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include <linux/tcp.h>
#include <netinet/ip.h>
#include <netinet/ip_icmp.h>
#include <net/if_arp.h>
#include <stdio.h>

#define MAX_MSG_SIZE	1500	

/*ARP protocol hardware identifiers*/
#define ARPHRD_NETROM   0               /* from KA9Q: NET/ROM pseudo    */
#define ARPHRD_ETHER    1               /* Ethernet 10Mbps              */
#define ARPHRD_EETHER   2               /* Experimental Ethernet        */
#define ARPHRD_AX25     3               /* AX.25 Level 2                */
#define ARPHRD_PRONET   4               /* PROnet token ring            */
#define ARPHRD_CHAOS    5               /* Chaosnet                     */
#define ARPHRD_IEEE802  6               /* IEEE 802.2 Ethernet/TR/TB    */
#define ARPHRD_ARCNET   7               /* ARCnet                       */
#define ARPHRD_APPLETLK 8               /* APPLEtalk                    */
#define ARPHRD_DLCI     15              /* Frame Relay DLCI             */
#define ARPHRD_ATM      19              /* ATM                          */
#define ARPHRD_METRICOM 23              /* Metricom STRIP (new IANA id) */
#define ARPHRD_IEEE1394 24              /* IEEE 1394 IPv4 - RFC 2734    */
#define ARPHRD_EUI64    27              /* EUI-64                       */
#define ARPHRD_INFINIBAND 32            /* InfiniBand                   */

/*
 *      These are the defined Ethernet Protocol ID's.
 */

#define ETH_P_LOOP      0x0060          /* Ethernet Loopback packet     */
#define ETH_P_PUP       0x0200          /* Xerox PUP packet             */
#define ETH_P_PUPAT     0x0201          /* Xerox PUP Addr Trans packet  */
#define ETH_P_IP        0x0800          /* Internet Protocol packet     */
#define ETH_P_X25       0x0805          /* CCITT X.25                   */
#define ETH_P_ARP       0x0806          /* Address Resolution packet    */
#define ETH_P_BPQ       0x08FF          /* G8BPQ AX.25 Ethernet Packet  [ NOT AN OFFICIALLY REGISTERED ID ] */
#define ETH_P_IEEEPUP   0x0a00          /* Xerox IEEE802.3 PUP packet */
#define ETH_P_IEEEPUPAT 0x0a01          /* Xerox IEEE802.3 PUP Addr Trans packet */
#define ETH_P_DEC       0x6000          /* DEC Assigned proto           */
#define ETH_P_DNA_DL    0x6001          /* DEC DNA Dump/Load            */
#define ETH_P_DNA_RC    0x6002          /* DEC DNA Remote Console       */
#define ETH_P_DNA_RT    0x6003          /* DEC DNA Routing              */
#define ETH_P_LAT       0x6004          /* DEC LAT                      */
#define ETH_P_DIAG      0x6005          /* DEC Diagnostics              */
#define ETH_P_CUST      0x6006          /* DEC Customer use             */
#define ETH_P_SCA       0x6007          /* DEC Systems Comms Arch       */
#define ETH_P_TEB       0x6558          /* Trans Ether Bridging         */
#define ETH_P_RARP      0x8035          /* Reverse Addr Res packet      */
#define ETH_P_ATALK     0x809B          /* Appletalk DDP                */
#define ETH_P_AARP      0x80F3          /* Appletalk AARP               */
#define ETH_P_8021Q     0x8100          /* 802.1Q VLAN Extended Header  */
#define ETH_P_IPX       0x8137          /* IPX over DIX                 */
#define ETH_P_IPV6      0x86DD          /* IPv6 over bluebook           */
#define ETH_P_PAUSE     0x8808          /* IEEE Pause frames. See 802.3 31B */
#define ETH_P_SLOW      0x8809          /* Slow Protocol. See 802.3ad 43B */
#define ETH_P_WCCP      0x883E          /* Web-cache coordination protocol
                                         * defined in draft-wilson-wrec-wccp-v2-00.txt */
#define ETH_P_PPP_DISC  0x8863          /* PPPoE discovery messages     */
#define ETH_P_PPP_SES   0x8864          /* PPPoE session messages       */
#define ETH_P_MPLS_UC   0x8847          /* MPLS Unicast traffic         */
#define ETH_P_MPLS_MC   0x8848          /* MPLS Multicast traffic       */
#define ETH_P_ATMMPOA   0x884c          /* MultiProtocol Over ATM       */
#define ETH_P_ATMFATE   0x8884          /* Frame-based ATM Transport
                                         * over Ethernet
                                         */
#define ETH_P_PAE       0x888E          /* Port Access Entity (IEEE 802.1X) */
#define ETH_P_AOE       0x88A2          /* ATA over Ethernet            */
#define ETH_P_TIPC      0x88CA          /* TIPC                         */
#define ETH_P_1588      0x88F7          /* IEEE 1588 Timesync */
#define ETH_P_FCOE      0x8906          /* Fibre Channel over Ethernet  */
#define ETH_P_FIP       0x8914          /* FCoE Initialization Protocol */
#define ETH_P_EDSA      0xDADA          /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */


/* 
 * ARP protocol opcodes. 
 * 
 * For ARP packets
 */
#define ARPOP_REQUEST   1               /* ARP request                  */
#define ARPOP_REPLY     2               /* ARP reply                    */
#define ARPOP_RREQUEST  3               /* RARP request                 */
#define ARPOP_RREPLY    4               /* RARP reply                   */
#define ARPOP_InREQUEST 8               /* InARP request                */
#define ARPOP_InREPLY   9               /* InARP reply                  */
#define ARPOP_NAK       10              /* (ATM)ARP NAK                 */

/* 
 *
 * Layer 2 headers 
 *
 */
typedef struct orca_eth_s {
    /* Ethernet header */
    struct  ethhdr *orca_eth;
    int proto;	
}orca_eth_t;

/*
 *
 * Layer 3 headers 
 *
 */
typedef struct orca_arp_s {
    /* ARP header */
    struct  arphdr *orca_arphdr;
    int proto;
}orca_arp_t;

typedef struct orca_ip_s {
    /* IP header */
    struct  ip *orca_iphdr;
}orca_ip_t;

typedef struct orca_icmp_s {
    /* ICMP header */
    struct  icmphdr *orca_icmphdr;
}orca_icmp_t;

/*
 *
 * Layer 4 headers 
 *
 */
typedef struct orca_tcp_s {
    /* TCP header */
    struct  tcphdr *orca_tcphdr;
}orca_tcp_t;

typedef struct orca_udp_s {
    /* UDP header */
    struct  udphdr *orca_udphdr;
}orca_udp_t;

# endif   /* __ORCA_H__ */

